Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAJDBC-256 - Run integration tests with Oracle #103

Closed
wants to merge 3 commits into from

Conversation

bahrmichael
Copy link

  • Added testcontainer for Oracle 11XE and drivers which are available from mavencentral
  • Extended DefaultDataAccessStrategy with database aware setting of idColumns
  • Updated SelectBuilder to not use AS on joins as Oracle does not understand this
  • Added Oracle database setup scripts for AggregateTemplateIntegrationTests and IfProfileValue where I haven't added Oracle setup scripts yet. I used § as a custom delimiter as it was the first I found, can be changed. The custom delimiter is however necessary to allow the PL/SQL style setup of triggers for id generation.
  • Build has been checked with mvn test -Pall-dbs.

Michael Bahr added 2 commits November 17, 2018 23:14
Signed-off-by: Michael Bahr <michael.bahr@live.de>
Signed-off-by: Michael Bahr <michael.bahr@live.de>
Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good.

I left some detailed wishes.

I'm not sure why you have almost all integration tests disabled since at least one, possibly many should be easy to make work.
See 4208511
Maybe this is due to a misunderstanding of what I said earlier.
It is ok to disable tests if you can't make it succeed.
In those cases, I need a comment explaining what the problem is.
Ideally just a link to a Jira issue which contains the explanation.

@@ -44,12 +38,22 @@
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

import java.sql.Connection;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to configure your code formatter: https://github.com/spring-projects/spring-data-build/tree/master/etc/ide

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -339,6 +346,31 @@ public long count(Class<?> domainType) {
}
}

Optional<String> getIdColumnNameIfOracle(@Nullable final RelationalPersistentProperty idProperty) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic should get moved out of the DefaultDataAccessStrategy.

To be more specific:

  1. create an interface DatabaseDialect with a method boolean registerGeneratedColumns.

  2. provide two implementations: One for Oracle and one default one.

  3. Inject it into the Data

  4. add a DatabaseDialect bean to JdbcConfiguration

  5. Inject the bean into DefaultDataAccessStrategy

  6. For tests provide the Oracle variant in the OracleDataSourceConfiguration.

  7. We do not need to provide detection logic, that is probably better done by Spring Boot.

parameters.forEach(parameterSource::addValue);

operations.update( //
sql(domainType).getInsert(parameters.keySet()), //
parameterSource, //
holder //
holder, //
idColumnName.isPresent() ? new String[]{idColumnName.get()} : (String[])null //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need this to also depend on if the id is already set.

@Override
protected void customizePopulator(ResourceDatabasePopulator populator) {
populator.setIgnoreFailedDrops(true);
populator.setSeparator("§");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
populator.setSeparator("§");
populator.setSeparator("/");

The paragraph symbol is hard to type (I don't think I have it on my keyboard) and the / is pretty much Oracles standard for this purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bahrmichael
Copy link
Author

Thanks for the feedback! I'll look into it over the holidays.

…ests

Signed-off-by: Michael Bahr <michael.bahr@live.de>
@@ -0,0 +1 @@
oracle.container.image=wnameless/oracle-xe-11g@sha256:825ba799432809fc7200bb1d7ef954973a8991d7702a860c87177fe05301f7da
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must not use this docker image since it is not on supported by Oracle and quite possibly illegal to use.

Please only use official Oracle images: https://github.com/oracle/docker-images

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might make things a lot easier (e.g. ID columns). Somehow previously I only found images that one would have to build locally. I assume requiring a docker login for pulling the Oracle images before running the Oracle tests is ok? (note that the downloaded docker image is 5GB+)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a login to Docker is ok.

@agackovka
Copy link

Hey, guys, it would be very very nice to have this PR merged

@bahrmichael
Copy link
Author

Hey, guys, it would be very very nice to have this PR merged

We're not ready for merging it yet. I had a couple rather busy weeks/months, but should find more time to finish this soon :)

@schauder
Copy link
Contributor

Also, note this is just about being able to execute the tests and fixing the obvious and easy issues. We'll probably need another issue for making it actually work with Oracle.

@bahrmichael
Copy link
Author

I will stop working on this. Even with Oracle 12 I don't see this MR to be properly completed within a reasonable time. Thank you for supporting me in trying.

@bahrmichael bahrmichael closed this Feb 8, 2019
@schauder
Copy link
Contributor

That is unfortunate but perfectly understandable.

Thanks for your work I'll take it from here then.

mp911de added a commit that referenced this pull request Feb 21, 2022
…ion.

RowsFetchSpec.awaitOne() and RowsFetchSpec.awaitFirst() now throw EmptyResultDataAccessException instead of NoSuchElementException to consistently use Spring DAO exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants